<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
     var arr = [1,2,3,4,5,7,8,9];
     var len = arr.length+1
     var sum =0;
     for(var i =0;i<arr.length;i++){
         sum = sum+arr[i];
     }
     console.log(sum);
     console.log((((arr[0]+arr[7])*len)/2)-sum);
    </script>
</head>
<body>
    

</body>
</html>